# Maintainer: Daniel Bermond <dbermond@archlinux.org>

pkgname=libmysofa
pkgver=1.3.1
pkgrel=2
pkgdesc='C library to read HRTFs if they are stored in the AES69-2015 SOFA format'
arch=('loong64' 'x86_64')
url='https://github.com/hoene/libmysofa/'
license=('BSD')
depends=('zlib')
makedepends=('cmake' 'cunit' 'ninja')
checkdepends=('nodejs')
provides=('libmysofa.so')
source=("https://github.com/hoene/libmysofa/archive/v${pkgver}/${pkgname}-${pkgver}.tar.gz")
sha256sums=('a8a8cbf7b0b2508a6932278799b9bf5c63d833d9e7d651aea4622f3bc6b992aa')

build() {
    cmake \
        -B "${pkgname}-${pkgver}/build" \
        -S "${pkgname}-${pkgver}" \
        -G Ninja \
        -DCMAKE_BUILD_TYPE:STRING='None' \
        -DCMAKE_INSTALL_PREFIX:PATH='/usr' \
        -DCODE_COVERAGE:BOOL='OFF' \
        -Wno-dev
    cmake --build "${pkgname}-${pkgver}/build"
}

check() {
    cd "${pkgname}-${pkgver}/build"
    ctest --output-on-failure --stop-on-failure -j1
}

package() {
    DESTDIR="${pkgdir}" cmake --install "${pkgname}-${pkgver}/build"
    install -D -m644 "${pkgname}-${pkgver}/LICENSE" -t "${pkgdir}/usr/share/licenses/${pkgname}"
}

# vim:set sw=4 sts=-1 et:
